<template>
    <div>
      <!-- 卡片视图 -->
        <el-card shadow="always">
            <!-- 面包屑导航 -->
            <el-breadcrumb separator-class="el-icon-arrow-right">
                <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                <el-breadcrumb-item>财务</el-breadcrumb-item>
                <el-breadcrumb-item>交易明细查询</el-breadcrumb-item>
            </el-breadcrumb>
            <!-- 搜索框 -->
            <el-input style="width:280px;" placeholder="请输入订单编号" class="search" v-model="searchData" clearable>
                <i slot="prefix" class="el-input__icon el-icon-search"></i>>
                <el-button slot="append" @click="searchBtn" :disabled="isDisabled">搜索</el-button>
            </el-input>
            <!-- 数据列表 -->
            <el-table :data="tableData" border>
                <el-table-column type="index" label="#" width="75"></el-table-column>
                <el-table-column prop="number" label="订单编号"></el-table-column>
                <el-table-column prop="type_title" label="交易类型"></el-table-column>
                <el-table-column prop="" label="结算人"></el-table-column>
                <el-table-column prop="money" label="金额"></el-table-column>
                <el-table-column prop="" label="时间">{{'2020-10-05 16:17'}}</el-table-column>
                <el-table-column prop="" label="结算类型">{{'自动'}}</el-table-column>
            </el-table>
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="p"
              :page-sizes="[10, 20, 50, 80]"
              :page-size="limit"
              layout="total, sizes, prev, pager, next, jumper"
              :total="count"
            ></el-pagination>
        </el-card>
    </div>
</template>

<script>
import {get} from "../../../../public/API/query";
import config from '../../../../public/config'

export default {
    data() {
        return {
            //搜索
            searchData:'',
            //列表数据
            tableData: [],
            //查询参数
            p: 1,
            limit: 10,
            //总条数
            count: null,
            currentPage4: 1,
            value: [],
            treeData: [],
            addGroupForm: {
                title: "",
            },
            //默认选择节点ID数组
            defaultKeys: [],
            isDisabled: false,
            userId: "",
        };
    },
    methods: {
        //设置权限
        setRights(value) {
            
        },
        // 重置节点ID数组
        setRightDialogClose() {
            this.defaultKeys = [];
        },
        //提交权限按钮
        commitRightsBtn() {
           
        },
        handleSizeChange(newSize) {
            this.limit = newSize;
            this.getTableData();
        },
        handleCurrentChange(newPage) {
            this.p = newPage;
            this.getTableData();
        },
        //搜索功能
        searchBtn() {
            this.getTableData()
        },
        //获取数据
        getTableData(){
            if (this.searchData) {
                get('finance/tranDeatil/index',{
                    p:this.p,
                    limit:this.limit,
                    title:this.searchData
                },res=>{
                    this.tableData = res.data.result
                    this.count = res.data.count
                })
            }else{
                get('finance/tranDeatil/index',{
                    p:this.p,
                    limit:this.limit,
                },res=>{
                    this.tableData = res.data.result
                    this.count = res.data.count
                })
            }
            
        }
    },
    watch: {
        searchData: function() {
            if (!this.searchData) {
                this.getTableData();
            }
            if (this.searchData) {
                this.isDisabled = false;
            }
        },
    },

    created() {
        get('finance/tranDeatil/index',{},res=>{
            console.log(res);
        })
        this.getTableData();
        
    },
};
</script>

<style lang="less" scoped>
.el-breadcrumb {
    margin-bottom: 30px;
}
.el-input {
    margin-bottom: 30px;
    width: 280px;
    margin-right: 30px;
}
.el-pagination {
    margin-top: 30px;
}
.addRulesWrap {
    margin-left: 80px;
}
.addRules {
    position: absolute;
    right: 25%;
    bottom: 5%;
}
.disable {
    margin-left: 15px;
}
</style>
